3.9.15 \(\int (d \csc (e+f x))^n (3+3 \sin (e+f x))^2 \, dx\) [815]

3.9.15.1 Optimal result
3.9.15.2 Mathematica [A] (verified)
3.9.15.3 Rubi [A] (verified)
3.9.15.4 Maple [F]
3.9.15.5 Fricas [F]
3.9.15.6 Sympy [F]
3.9.15.7 Maxima [F]
3.9.15.8 Giac [F]
3.9.15.9 Mupad [F(-1)]

3.9.15.1 Optimal result

Integrand size = 23, antiderivative size = 196 \[ \int (d \csc (e+f x))^n (3+3 \sin (e+f x))^2 \, dx=\frac {9 d^2 \cot (e+f x) (d \csc (e+f x))^{-2+n}}{f (1-n)}+\frac {18 d^2 \cos (e+f x) (d \csc (e+f x))^{-2+n} \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {2-n}{2},\frac {4-n}{2},\sin ^2(e+f x)\right )}{f (2-n) \sqrt {\cos ^2(e+f x)}}+\frac {9 d^3 (3-2 n) \cos (e+f x) (d \csc (e+f x))^{-3+n} \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {3-n}{2},\frac {5-n}{2},\sin ^2(e+f x)\right )}{f (1-n) (3-n) \sqrt {\cos ^2(e+f x)}} \]

output
a^2*d^2*cot(f*x+e)*(d*csc(f*x+e))^(-2+n)/f/(1-n)+2*a^2*d^2*cos(f*x+e)*(d*c 
sc(f*x+e))^(-2+n)*hypergeom([1/2, 1-1/2*n],[2-1/2*n],sin(f*x+e)^2)/f/(2-n) 
/(cos(f*x+e)^2)^(1/2)+a^2*d^3*(3-2*n)*cos(f*x+e)*(d*csc(f*x+e))^(-3+n)*hyp 
ergeom([1/2, 3/2-1/2*n],[5/2-1/2*n],sin(f*x+e)^2)/f/(n^2-4*n+3)/(cos(f*x+e 
)^2)^(1/2)
 
3.9.15.2 Mathematica [A] (verified)

Time = 4.97 (sec) , antiderivative size = 307, normalized size of antiderivative = 1.57 \[ \int (d \csc (e+f x))^n (3+3 \sin (e+f x))^2 \, dx=\frac {18 (d \csc (e+f x))^n \sec ^2\left (\frac {1}{2} (e+f x)\right )^{-n} \tan \left (\frac {1}{2} (e+f x)\right ) \left (\frac {\operatorname {Hypergeometric2F1}\left (3-n,\frac {1}{2}-\frac {n}{2},\frac {3}{2}-\frac {n}{2},-\tan ^2\left (\frac {1}{2} (e+f x)\right )\right )}{1-n}+\tan \left (\frac {1}{2} (e+f x)\right ) \left (-\frac {4 \operatorname {Hypergeometric2F1}\left (3-n,1-\frac {n}{2},2-\frac {n}{2},-\tan ^2\left (\frac {1}{2} (e+f x)\right )\right )}{-2+n}+\tan \left (\frac {1}{2} (e+f x)\right ) \left (-\frac {6 \operatorname {Hypergeometric2F1}\left (\frac {3-n}{2},3-n,\frac {5-n}{2},-\tan ^2\left (\frac {1}{2} (e+f x)\right )\right )}{-3+n}-\frac {4 \operatorname {Hypergeometric2F1}\left (3-n,2-\frac {n}{2},3-\frac {n}{2},-\tan ^2\left (\frac {1}{2} (e+f x)\right )\right ) \tan \left (\frac {1}{2} (e+f x)\right )}{-4+n}+\frac {\operatorname {Hypergeometric2F1}\left (3-n,\frac {5}{2}-\frac {n}{2},\frac {7}{2}-\frac {n}{2},-\tan ^2\left (\frac {1}{2} (e+f x)\right )\right ) \tan ^2\left (\frac {1}{2} (e+f x)\right )}{5-n}\right )\right )\right )}{f} \]

input
Integrate[(d*Csc[e + f*x])^n*(3 + 3*Sin[e + f*x])^2,x]
 
output
(18*(d*Csc[e + f*x])^n*Tan[(e + f*x)/2]*(Hypergeometric2F1[3 - n, 1/2 - n/ 
2, 3/2 - n/2, -Tan[(e + f*x)/2]^2]/(1 - n) + Tan[(e + f*x)/2]*((-4*Hyperge 
ometric2F1[3 - n, 1 - n/2, 2 - n/2, -Tan[(e + f*x)/2]^2])/(-2 + n) + Tan[( 
e + f*x)/2]*((-6*Hypergeometric2F1[(3 - n)/2, 3 - n, (5 - n)/2, -Tan[(e + 
f*x)/2]^2])/(-3 + n) - (4*Hypergeometric2F1[3 - n, 2 - n/2, 3 - n/2, -Tan[ 
(e + f*x)/2]^2]*Tan[(e + f*x)/2])/(-4 + n) + (Hypergeometric2F1[3 - n, 5/2 
 - n/2, 7/2 - n/2, -Tan[(e + f*x)/2]^2]*Tan[(e + f*x)/2]^2)/(5 - n)))))/(f 
*(Sec[(e + f*x)/2]^2)^n)
 
3.9.15.3 Rubi [A] (verified)

Time = 0.96 (sec) , antiderivative size = 199, normalized size of antiderivative = 1.02, number of steps used = 13, number of rules used = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.565, Rules used = {3042, 3717, 3042, 4275, 3042, 4259, 3042, 3122, 4534, 3042, 4259, 3042, 3122}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int (a \sin (e+f x)+a)^2 (d \csc (e+f x))^n \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int (a \sin (e+f x)+a)^2 (d \csc (e+f x))^ndx\)

\(\Big \downarrow \) 3717

\(\displaystyle d^2 \int (d \csc (e+f x))^{n-2} (\csc (e+f x) a+a)^2dx\)

\(\Big \downarrow \) 3042

\(\displaystyle d^2 \int (d \csc (e+f x))^{n-2} (\csc (e+f x) a+a)^2dx\)

\(\Big \downarrow \) 4275

\(\displaystyle d^2 \left (\int (d \csc (e+f x))^{n-2} \left (\csc ^2(e+f x) a^2+a^2\right )dx+\frac {2 a^2 \int (d \csc (e+f x))^{n-1}dx}{d}\right )\)

\(\Big \downarrow \) 3042

\(\displaystyle d^2 \left (\frac {2 a^2 \int (d \csc (e+f x))^{n-1}dx}{d}+\int (d \csc (e+f x))^{n-2} \left (\csc (e+f x)^2 a^2+a^2\right )dx\right )\)

\(\Big \downarrow \) 4259

\(\displaystyle d^2 \left (\int (d \csc (e+f x))^{n-2} \left (\csc (e+f x)^2 a^2+a^2\right )dx+\frac {2 a^2 \left (\frac {\sin (e+f x)}{d}\right )^n (d \csc (e+f x))^n \int \left (\frac {\sin (e+f x)}{d}\right )^{1-n}dx}{d}\right )\)

\(\Big \downarrow \) 3042

\(\displaystyle d^2 \left (\int (d \csc (e+f x))^{n-2} \left (\csc (e+f x)^2 a^2+a^2\right )dx+\frac {2 a^2 \left (\frac {\sin (e+f x)}{d}\right )^n (d \csc (e+f x))^n \int \left (\frac {\sin (e+f x)}{d}\right )^{1-n}dx}{d}\right )\)

\(\Big \downarrow \) 3122

\(\displaystyle d^2 \left (\int (d \csc (e+f x))^{n-2} \left (\csc (e+f x)^2 a^2+a^2\right )dx+\frac {2 a^2 \cos (e+f x) (d \csc (e+f x))^{n-2} \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {2-n}{2},\frac {4-n}{2},\sin ^2(e+f x)\right )}{f (2-n) \sqrt {\cos ^2(e+f x)}}\right )\)

\(\Big \downarrow \) 4534

\(\displaystyle d^2 \left (\frac {a^2 (3-2 n) \int (d \csc (e+f x))^{n-2}dx}{1-n}+\frac {2 a^2 \cos (e+f x) (d \csc (e+f x))^{n-2} \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {2-n}{2},\frac {4-n}{2},\sin ^2(e+f x)\right )}{f (2-n) \sqrt {\cos ^2(e+f x)}}+\frac {a^2 \cot (e+f x) (d \csc (e+f x))^{n-2}}{f (1-n)}\right )\)

\(\Big \downarrow \) 3042

\(\displaystyle d^2 \left (\frac {a^2 (3-2 n) \int (d \csc (e+f x))^{n-2}dx}{1-n}+\frac {2 a^2 \cos (e+f x) (d \csc (e+f x))^{n-2} \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {2-n}{2},\frac {4-n}{2},\sin ^2(e+f x)\right )}{f (2-n) \sqrt {\cos ^2(e+f x)}}+\frac {a^2 \cot (e+f x) (d \csc (e+f x))^{n-2}}{f (1-n)}\right )\)

\(\Big \downarrow \) 4259

\(\displaystyle d^2 \left (\frac {a^2 (3-2 n) \left (\frac {\sin (e+f x)}{d}\right )^n (d \csc (e+f x))^n \int \left (\frac {\sin (e+f x)}{d}\right )^{2-n}dx}{1-n}+\frac {2 a^2 \cos (e+f x) (d \csc (e+f x))^{n-2} \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {2-n}{2},\frac {4-n}{2},\sin ^2(e+f x)\right )}{f (2-n) \sqrt {\cos ^2(e+f x)}}+\frac {a^2 \cot (e+f x) (d \csc (e+f x))^{n-2}}{f (1-n)}\right )\)

\(\Big \downarrow \) 3042

\(\displaystyle d^2 \left (\frac {a^2 (3-2 n) \left (\frac {\sin (e+f x)}{d}\right )^n (d \csc (e+f x))^n \int \left (\frac {\sin (e+f x)}{d}\right )^{2-n}dx}{1-n}+\frac {2 a^2 \cos (e+f x) (d \csc (e+f x))^{n-2} \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {2-n}{2},\frac {4-n}{2},\sin ^2(e+f x)\right )}{f (2-n) \sqrt {\cos ^2(e+f x)}}+\frac {a^2 \cot (e+f x) (d \csc (e+f x))^{n-2}}{f (1-n)}\right )\)

\(\Big \downarrow \) 3122

\(\displaystyle d^2 \left (\frac {a^2 d (3-2 n) \cos (e+f x) (d \csc (e+f x))^{n-3} \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {3-n}{2},\frac {5-n}{2},\sin ^2(e+f x)\right )}{f (1-n) (3-n) \sqrt {\cos ^2(e+f x)}}+\frac {2 a^2 \cos (e+f x) (d \csc (e+f x))^{n-2} \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {2-n}{2},\frac {4-n}{2},\sin ^2(e+f x)\right )}{f (2-n) \sqrt {\cos ^2(e+f x)}}+\frac {a^2 \cot (e+f x) (d \csc (e+f x))^{n-2}}{f (1-n)}\right )\)

input
Int[(d*Csc[e + f*x])^n*(a + a*Sin[e + f*x])^2,x]
 
output
d^2*((a^2*Cot[e + f*x]*(d*Csc[e + f*x])^(-2 + n))/(f*(1 - n)) + (2*a^2*Cos 
[e + f*x]*(d*Csc[e + f*x])^(-2 + n)*Hypergeometric2F1[1/2, (2 - n)/2, (4 - 
 n)/2, Sin[e + f*x]^2])/(f*(2 - n)*Sqrt[Cos[e + f*x]^2]) + (a^2*d*(3 - 2*n 
)*Cos[e + f*x]*(d*Csc[e + f*x])^(-3 + n)*Hypergeometric2F1[1/2, (3 - n)/2, 
 (5 - n)/2, Sin[e + f*x]^2])/(f*(1 - n)*(3 - n)*Sqrt[Cos[e + f*x]^2]))
 

3.9.15.3.1 Defintions of rubi rules used

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3122
Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[Cos[c + d*x]*(( 
b*Sin[c + d*x])^(n + 1)/(b*d*(n + 1)*Sqrt[Cos[c + d*x]^2]))*Hypergeometric2 
F1[1/2, (n + 1)/2, (n + 3)/2, Sin[c + d*x]^2], x] /; FreeQ[{b, c, d, n}, x] 
 &&  !IntegerQ[2*n]
 

rule 3717
Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(m_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x 
_)]^(n_.))^(p_.), x_Symbol] :> Simp[d^(n*p)   Int[(d*Csc[e + f*x])^(m - n*p 
)*(b + a*Csc[e + f*x]^n)^p, x], x] /; FreeQ[{a, b, d, e, f, m, n, p}, x] && 
  !IntegerQ[m] && IntegersQ[n, p]
 

rule 4259
Int[(csc[(c_.) + (d_.)*(x_)]*(b_.))^(n_), x_Symbol] :> Simp[(b*Csc[c + d*x] 
)^(n - 1)*((Sin[c + d*x]/b)^(n - 1)   Int[1/(Sin[c + d*x]/b)^n, x]), x] /; 
FreeQ[{b, c, d, n}, x] &&  !IntegerQ[n]
 

rule 4275
Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + 
(a_))^2, x_Symbol] :> Simp[2*a*(b/d)   Int[(d*Csc[e + f*x])^(n + 1), x], x] 
 + Int[(d*Csc[e + f*x])^n*(a^2 + b^2*Csc[e + f*x]^2), x] /; FreeQ[{a, b, d, 
 e, f, n}, x]
 

rule 4534
Int[(csc[(e_.) + (f_.)*(x_)]*(b_.))^(m_.)*(csc[(e_.) + (f_.)*(x_)]^2*(C_.) 
+ (A_)), x_Symbol] :> Simp[(-C)*Cot[e + f*x]*((b*Csc[e + f*x])^m/(f*(m + 1) 
)), x] + Simp[(C*m + A*(m + 1))/(m + 1)   Int[(b*Csc[e + f*x])^m, x], x] /; 
 FreeQ[{b, e, f, A, C, m}, x] && NeQ[C*m + A*(m + 1), 0] &&  !LeQ[m, -1]
 
3.9.15.4 Maple [F]

\[\int \left (d \csc \left (f x +e \right )\right )^{n} \left (a +a \sin \left (f x +e \right )\right )^{2}d x\]

input
int((d*csc(f*x+e))^n*(a+a*sin(f*x+e))^2,x)
 
output
int((d*csc(f*x+e))^n*(a+a*sin(f*x+e))^2,x)
 
3.9.15.5 Fricas [F]

\[ \int (d \csc (e+f x))^n (3+3 \sin (e+f x))^2 \, dx=\int { {\left (a \sin \left (f x + e\right ) + a\right )}^{2} \left (d \csc \left (f x + e\right )\right )^{n} \,d x } \]

input
integrate((d*csc(f*x+e))^n*(a+a*sin(f*x+e))^2,x, algorithm="fricas")
 
output
integral(-(a^2*cos(f*x + e)^2 - 2*a^2*sin(f*x + e) - 2*a^2)*(d*csc(f*x + e 
))^n, x)
 
3.9.15.6 Sympy [F]

\[ \int (d \csc (e+f x))^n (3+3 \sin (e+f x))^2 \, dx=a^{2} \left (\int \left (d \csc {\left (e + f x \right )}\right )^{n}\, dx + \int 2 \left (d \csc {\left (e + f x \right )}\right )^{n} \sin {\left (e + f x \right )}\, dx + \int \left (d \csc {\left (e + f x \right )}\right )^{n} \sin ^{2}{\left (e + f x \right )}\, dx\right ) \]

input
integrate((d*csc(f*x+e))**n*(a+a*sin(f*x+e))**2,x)
 
output
a**2*(Integral((d*csc(e + f*x))**n, x) + Integral(2*(d*csc(e + f*x))**n*si 
n(e + f*x), x) + Integral((d*csc(e + f*x))**n*sin(e + f*x)**2, x))
 
3.9.15.7 Maxima [F]

\[ \int (d \csc (e+f x))^n (3+3 \sin (e+f x))^2 \, dx=\int { {\left (a \sin \left (f x + e\right ) + a\right )}^{2} \left (d \csc \left (f x + e\right )\right )^{n} \,d x } \]

input
integrate((d*csc(f*x+e))^n*(a+a*sin(f*x+e))^2,x, algorithm="maxima")
 
output
integrate((a*sin(f*x + e) + a)^2*(d*csc(f*x + e))^n, x)
 
3.9.15.8 Giac [F]

\[ \int (d \csc (e+f x))^n (3+3 \sin (e+f x))^2 \, dx=\int { {\left (a \sin \left (f x + e\right ) + a\right )}^{2} \left (d \csc \left (f x + e\right )\right )^{n} \,d x } \]

input
integrate((d*csc(f*x+e))^n*(a+a*sin(f*x+e))^2,x, algorithm="giac")
 
output
integrate((a*sin(f*x + e) + a)^2*(d*csc(f*x + e))^n, x)
 
3.9.15.9 Mupad [F(-1)]

Timed out. \[ \int (d \csc (e+f x))^n (3+3 \sin (e+f x))^2 \, dx=\int {\left (\frac {d}{\sin \left (e+f\,x\right )}\right )}^n\,{\left (a+a\,\sin \left (e+f\,x\right )\right )}^2 \,d x \]

input
int((d/sin(e + f*x))^n*(a + a*sin(e + f*x))^2,x)
 
output
int((d/sin(e + f*x))^n*(a + a*sin(e + f*x))^2, x)